home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_222 / plplot / src / source.zoo / fcnvrt.c < prev    next >
C/C++ Source or Header  |  1989-05-15  |  2KB  |  93 lines

  1. /* Coordinate transformations for plotting package */
  2.  
  3. #include "plplot.h"
  4. #include "declare.h"
  5. #include <math.h>
  6.  
  7. /* dcmm. converts from device coordinates to millimetres from bottom */
  8. /* left-hand corner */
  9.  
  10. float dcmmx(x)
  11. float x;
  12. {
  13.       return((float)(x * abs(phyxma-phyxmi) / xpmm));
  14. }
  15.  
  16. float dcmmy(y)
  17. float y;
  18. {
  19.       return((float)(y * abs(phyyma-phyymi) / ypmm));
  20. }
  21.  
  22. /* dcsc. define transformations between device coordinates and subpage */
  23. /* coordinates */
  24.  
  25. float dcscx(x)
  26. float x;
  27. {
  28.       return((float)((x - spdxmi)/(spdxma-spdxmi)));
  29. }
  30.  
  31. float dcscy(y)
  32. float y;
  33. {
  34.       return((float)((y - spdymi)/(spdyma-spdymi)));
  35. }
  36.  
  37. /* mmdc. converts millimetres from bottom left corner into device */
  38. /* coordinates */
  39.  
  40. float mmdcx(x)
  41. float x;
  42. {
  43.       return((float)(x * xpmm / abs(phyxma - phyxmi)));
  44. }
  45.  
  46. float mmdcy(y)
  47. float y;
  48. {
  49.       return((float)(y * ypmm / abs(phyyma - phyymi)));
  50. }
  51.  
  52. /* scdc. converts subpage coordinates to device coordinates */
  53.  
  54. float scdcx(x)
  55. float x;
  56. {
  57.       return((float)(spdxmi + (spdxma-spdxmi) * x));
  58. }
  59.  
  60. float scdcy(y)
  61. float y;
  62. {
  63.       return((float)(spdymi + (spdyma-spdymi) * y));
  64. }
  65.  
  66. /* wcmm. converts world coordinates into millimetres */
  67.  
  68. float wcmmx(x)
  69. float x;
  70. {
  71.       return((float)(wmxoff + wmxscl*x));
  72. }
  73.  
  74. float wcmmy(y)
  75. float y;
  76. {
  77.       return((float)(wmyoff + wmyscl*y));
  78. }
  79.  
  80. float w3wcx(x,y,z)
  81. float x, y, z;
  82. {
  83.       return((float)((x-basecx)*cxx + (y-basecy)*cxy));
  84. }
  85.  
  86. float w3wcy(x,y,z)
  87. float x, y, z;
  88. {
  89.       return((float)((x-basecx)*cyx+(y-basecy)*cyy+(z-ranmi)*cyz));
  90. }
  91.  
  92.  
  93.